#pragma once

#include <boostext/iostreams/bin_ostream.hpp>
#include <QtCore/QVector>
#include <QtCore/QPair>

#include "exports.hpp"




namespace Engine
{
	namespace Script
	{
		class ENGINE_SCRIPT_API Enum
		{
		public:

			typedef QVector<QPair<QString,int>>   Values;

			Enum(int id, QString name, Values values);



			/**
			 * @returns the id of this enum
			 */
			int id() const;

			/**
			 * @returns the name of this enum
			 */
			QString name() const;

			/**
			 * @returns the number enum values
			 */
			int valueCount() const;

			/**
			 * @returns the name of the value with the given index
			 */
			QString name(int index) const;

			/**
			 * @returns the value with the given index
			 */
			int value(int index) const;



			/**
			 * Compares this enums state agains the one in the given stream
			 * and throws if there are differences.
			 */
			void compareState(boostext::iostreams::bin_istream& stream) const;

			/**
			 * Serializes most relevant information of this type.
			 */
			void saveState(boostext::iostreams::bin_ostream& stream) const;

		private:

			int       m_id;
			QString   m_name;
			Values    m_values;
		};
		///////////////////////////////////////////////////////////////////////////////////////////
	}
	///////////////////////////////////////////////////////////////////////////////////////////////
}
///////////////////////////////////////////////////////////////////////////////////////////////////
